/*
 * @Author: LiuYan
 * @Date: 2023-01-10 14:28:40
 * @LastEditors: LiuYan
 * @LastEditTime: 2023-01-10 15:30:55
 * @Description:
 */
//简单做下持久化
export default function persistent({ store }) {
  if (localStorage.getItem("store"))
    store.$state = JSON.parse(localStorage.getItem("store"));
  store.$subscribe(() => {
    localStorage.setItem("store", JSON.stringify(store.$state));
  });
}
